/*
 *  Copyright © 2014 CIB Co.Ltd
 *  * All right reserved
 *  * Auther:jin xingwang
 *
 */

package com.wsd.scheduler;

import com.wsd.service.OverdueUpdateService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.time.LocalDateTime;

/**
 * 自动检查逾期
 * @author 靳兴旺
 * @version 1.0.0 2020-7-21
 */
public class OverdueCheckTimer extends QuartzJobBean {

    static Logger logger = LoggerFactory.getLogger(OverdueCheckTimer.class);

    @Autowired
    private OverdueUpdateService overdueUpdateService;

    /**
     * 任务执行
     * @param jobExecutionContext 上下文
     */
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) {
        logger.info("执行自动检查逾期任务， 时间{}", LocalDateTime.now());
        overdueUpdateService.UpdateOverdueInformation();
        logger.info("执行自动检查逾期任务成功，时间{}", LocalDateTime.now());
    }
}
